<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>WebSocket Connect</title>
    <script src="js/sockjs-0.3.4.js" type="text/javascript"></script>
    <script src="js/stomp.js" type="text/javascript"></script>
    <script>
        var stomClient = null;

        function setConnected(connected) {
            if(connected){
                console.log("Connected ................")
            }
        }
        function connect () {
            var socket = new SockJS("hello");
            stomClient = Stomp.over(socket);
            stomClient.connect({}, function (frame) {
                setConnected(true);
                console.log("Connected :" + frame);
                
            });
        }

        function disconnect () {
            stomClient.disconnect(function (callback) {
                console.log("disconnected " + callback);
            })
        }
        
        connect();
        
    </script>
</head>
<body>
    <button value="Disconnect" onclick="disconnect()"></button>
</body>
</html>